Other Classes

The following classes are available globally.

  • Information about an attribution statement, usually a copyright or trademark statement, associated with a map content source.

    See more

    Declaration

    Objective-C

    
    @interface MGLAttributionInfo : NSObject

    Swift

    class MGLAttributionInfo : NSObject
  • MGLImageSource is a content source that is used for a georeferenced raster image to be shown on the map. The georeferenced image scales and rotates as the user zooms and rotates the map. Images may also be used as icons or patterns in a style layer. To register an image for use as an icon or pattern, use the -[MGLStyle setImage:forName:] method. To configure a point annotation’s image, use the MGLAnnotationImage class.

    The geographic location of the raster image content, supplied with MGLCoordinateQuad, can be non-axis aligned. MGLImageSource supports raster content from NSURL, NSImage (macOS), or UIImage (iOS). An image source is added to an MGLStyle object along with one or more MGLRasterStyleLayer objects. Use a raster style layer to control the appearance of content supplied by the image source.

    Each image source defined by the style JSON file is represented at runtime by an MGLImageSource object that you can use to initialize new style layers. You can also add and remove sources dynamically using methods such as -[MGLStyle addSource:] and -[MGLStyle sourceWithIdentifier:].

    Example

    let coordinates = MGLCoordinateQuad(
      topLeft: CLLocationCoordinate2D(latitude: 46.437, longitude: -80.425),
      bottomLeft: CLLocationCoordinate2D(latitude: 37.936, longitude: -80.425),
      bottomRight: CLLocationCoordinate2D(latitude: 37.936, longitude: -71.516),
      topRight: CLLocationCoordinate2D(latitude: 46.437, longitude: -71.516))
    let source = MGLImageSource(identifier: "radar", coordinateQuad: coordinates, url: URL(string: "https://www.mapbox.com/mapbox-gl-js/assets/radar.gif")!)
    mapView.style?.addSource(source)
    
    See more

    Declaration

    Objective-C

    
    @interface MGLImageSource : MGLSource

    Swift

    class MGLImageSource : MGLSource
  • An MGLConstantStyleValue object is a generic container for a style attribute value that remains constant as the zoom level changes. The layout and paint attribute properties of MGLStyleLayer objects can be set to MGLConstantStyleValue objects.

    The MGLConstantStyleValue class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLConstantStyleValue <T> : MGLStyleValue<T>

    Swift

    class MGLConstantStyleValue<T> : MGLStyleValue<T> where T : AnyObject
  • An MGLStyleFunction is a is an abstract superclass for functions that are defined by an MGLCameraStyleFunction, MGLSourceStyleFunction, or MGLCompositeStyleFunction object.

    Create instances of MGLCameraStyleFunction, MGLSourceStyleFunction, and MGLCompositeStyleFunction in order to use MGLStyleFunction‘s methods. Do not create instances of MGLStyleFunction directly, and do not create your own subclasses of this class.

    The MGLStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLStyleFunction <T> : MGLStyleValue<T>

    Swift

    class MGLStyleFunction<T> : MGLStyleValue<T> where T : AnyObject
  • An MGLCameraStyleFunction is a value function defining a style value that changes as the zoom level changes. The layout and paint attribute properties of an MGLStyleLayer object can be set to MGLCameraStyleFunction objects. Use a camera function to create the illusion of depth and control data density.

    The MGLCameraStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLCameraStyleFunction <T> : MGLStyleFunction<T>

    Swift

    class MGLCameraStyleFunction<T> : MGLStyleFunction<T> where T : AnyObject
  • An MGLSourceStyleFunction is a value function defining a style value that changes with its properties. The layout and paint attribute properties of an MGLStyleLayer object can be set to MGLSourceStyleFunction objects. Use source functions to visually differentate types of features within the same layer or create data visualizations.

    The MGLSourceStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLSourceStyleFunction <T> : MGLStyleFunction<T>

    Swift

    class MGLSourceStyleFunction<T> : MGLStyleFunction<T> where T : AnyObject
  • An MGLCompositeStyleFunction is a value function defining a style value that changes with the feature attributes at each map zoom level. The layout and paint attribute properties of an MGLStyleLayer object can be set to MGLCompositeStyleFunction objects. Use composite functions to allow the appearance of a map feature to change with both its attributes and the map zoom level.

    The MGLCompositeStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLCompositeStyleFunction <T> : MGLStyleFunction<T>

    Swift

    class MGLCompositeStyleFunction<T> : MGLStyleFunction<T> where T : AnyObject